namespace DotNetNuke.Modules.Admin.ResourceInstaller
{
    using DotNetNuke.Common.Utilities;
    using DotNetNuke.Entities.Modules;
    using System;
    using System.Collections;

    /// -----------------------------------------------------------------------------
    /// <summary>
    /// The PaDnnInstaller_V2Skin extends PaDnnInstallerBase to support V2 Skin Objects
    /// </summary>
    /// <remarks>
    /// </remarks>
    /// <history>
    /// [cnurse]	04/21/2005  documented
    /// </history>
    /// -----------------------------------------------------------------------------
    public class PaDnnInstaller_V2Skin : PaDnnInstallerBase
    {
        public PaDnnInstaller_V2Skin(PaInstallInfo InstallerInfo) : base(InstallerInfo)
        {
        }

        protected override void RegisterModules(PaFolder Folder, ArrayList Modules, ArrayList Controls)
        {
            IEnumerator refObjectHelperL0=null;
            this.InstallerInfo.Log.AddInfo(base.REGISTER_Controls);
            ModuleControlController objModuleControls = new ModuleControlController();
            try
            {
                refObjectHelperL0 = Controls.GetEnumerator();
                while (refObjectHelperL0.MoveNext())
                {
                    ModuleControlInfo objModuleControl = (ModuleControlInfo) refObjectHelperL0.Current;
                    objModuleControl.ModuleDefID = Null.NullInteger;
                    ModuleControlInfo objModuleControl2 = objModuleControls.GetModuleControlByKeyAndSrc(Null.NullInteger, objModuleControl.ControlKey, objModuleControl.ControlSrc);
                    if (objModuleControl2 == null)
                    {
                        objModuleControls.AddModuleControl(objModuleControl);
                    }
                    else
                    {
                        objModuleControl.ModuleControlID = objModuleControl2.ModuleControlID;
                        objModuleControls.UpdateModuleControl(objModuleControl);
                    }
                }
            }
            finally
            {
                if (refObjectHelperL0 is IDisposable)
                {
                    (refObjectHelperL0 as IDisposable).Dispose();
                }
            }
            this.InstallerInfo.Log.EndJob(base.REGISTER_End);
        }
    }
}

